import time
from Base.Base import Base
from selenium.webdriver.common.by import By


class Page2(Base):
    url = "https://www.baidu.com/s"
    inp_loc = (By.ID, 'kw')
    sou_loc = (By.ID,"su")
    png_loc = (By.CLASS_NAME, "soutu-btn")
    cua_loc = (By.XPATH, "/html/body/div/div[2]/div[5]/div[1]/div/form/div[2]/div[2]/div[2]/input")

    def bd_paei(self):
        self.send_keys(self.inp_loc, "我问")

    def bd_sou(self):
        self.click(self.sou_loc)

    def bd_cun(self, test):
        self.send_keys(self.cua_loc, test)

    def bd_go(self):
        self.open_url(self.url)
        print("打开百度")
        self.bd_paei()
        print("输入")
        self.bd_sou()
        self.bd_cun(r"C:\Users\shuohan\Desktop\课表.jpg")
        print("上传图片")
        time.sleep(2)
